/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lostreseditores.logica;

import com.lostreseditores.modelo.Grado;
import com.lostreseditores.persistencia.GradoFacadeLocal;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author DILOVE
 */
@Stateless
public class GradoLogica implements GradoLogicaLocal {
    @EJB
    private GradoFacadeLocal gradoDAO;
    @Override
    public void registrar(Grado grado) throws Exception {
        gradoDAO.create(grado);
    }

    @Override
    public void modificar(Grado grado) throws Exception {
        gradoDAO.edit(grado);
    }

    @Override
    public void eliminar(Grado grado) throws Exception {
        gradoDAO.remove(grado);
    }

    @Override
    public Grado consultarPorId(Integer idGrado) throws Exception {        
       return gradoDAO.find((Object)idGrado);
    }

    @Override
    public List<Grado> consultar() throws Exception {
        return gradoDAO.findAll();
    }
    
}
